package com.example.messagemodule.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.messagemodule.R;

/**
 * Created by SHICHENG
 * <p>
 * Time on
 */
public class AppointmentPicWaitView extends LinearLayout {
    private TextView appointmentPicTime;
    View view;

    public AppointmentPicWaitView(Context context) {
        super(context);
        init();
    }

    public AppointmentPicWaitView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public AppointmentPicWaitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    public AppointmentPicWaitView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        init();
    }


    void init(){
        view = LayoutInflater.from(getContext()).inflate(R.layout.view_appointment_pic, this);
        appointmentPicTime = (TextView) findViewById(R.id.appointment_pic_time);
        hideView();
    }

    public void setData(String data,int weekNum,String startTime,String endTime){
        String weekStr = "";
        switch (weekNum){
            case 1:
                weekStr = "（周一）";
                break;
            case 2:
                weekStr = "（周二）";
                break;
            case 3:
                weekStr = "（周三）";
                break;
            case 4:
                weekStr = "（周四）";
                break;
            case 5:
                weekStr = "（周五）";
                break;
            case 6:
                weekStr = "（周六）";
                break;
            case 7:
                weekStr = "（周日）";
                break;
        }

        String appointmentTime = data+weekStr+startTime+"-"+endTime;
        appointmentPicTime.setText(appointmentTime);
    }

    void showView(){
        view.setVisibility(VISIBLE);
    }

    void hideView(){
        view.setVisibility(GONE);
    }



}
